import requests


class NetworkingClass:
    # 上传文件
    def uploadFile(self,url,data,file):
        results = requests.post(url=url, data=data, files=file)
        print(results.status_code)

    #上传ipa文件到蒲公英
    def uploadIpaToPgy(self,filePath,apiKey,installType=2,password='test',updateDescription='自动化打包'):
        data = {
            "_api_key": apiKey,
            "installType": installType,
            "password": password,
            "updateDescription": updateDescription
        }
        file = {"file": open(filePath, "rb")}
        url = 'https://www.pgyer.com/apiv2/app/upload'
        self.uploadFile(url=url, data=data, file=file)

